{layout name='./base'}
		<form id="form">
			<div class="weui-cells weui-cells_form">
				<div class="weui-cell">
					<div class="weui-cell__hd"><label class="weui-label">用户手机号</label></div>
					<div class="weui-cell__bd">
						<input class="weui-input" type="tel" name="account" placeholder="请输入手机号" />
					</div>
				</div>
				<div class="weui-cell weui-cell_vcode">
			        <div class="weui-cell__hd"><label class="weui-label">验证码</label></div>
			        <div class="weui-cell__bd">
			            <input class="weui-input" type="tel" name="imgCode" placeholder="请输入验证码"/>
			        </div>
			        <div class="weui-cell__ft">
			            <img class="weui-vcode-img" src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?d='+Math.random();" />
			        </div>
			    </div>
				<div class="weui-cell">
					<div class="weui-cell__hd"><label class="weui-label">密码</label></div>
					<div class="weui-cell__bd">
						<input class="weui-input" type="password" name="password" placeholder="请输入密码"/>
					</div>
				</div><div class="weui-cell">
					<div class="weui-cell__hd"><label class="weui-label">确认密码</label></div>
					<div class="weui-cell__bd">
						<input class="weui-input" type="password" name="confirmPwd" placeholder="请确认密码"/>
					</div>
				</div>
				<div class="button-sp-area">
					<a href="javascript:;" id="register" class="weui-btn weui-btn_primary">注册</a>
				</div>
			</div>
		</form>
	<script type="text/javascript">
		$('#register').click(function(){
			var data = $('#form').serialize();
			$.ajax({
				type:"post",
				url:"/user/register?a"+Math.random(),
				data:data,
				dataType: "json",
				success: function(data){
					switch (data.code){
					    case 200:
						    weui.toast(data.msg, {
							    duration: 2000,
							    className: 'custom-classname',
							    callback: function(){location.href = '/user/index';}
							});
					        break;
					    case 'imgCode':
					    	weui.alert(data.msg);
					    	break;
					    case 'cfpwd':
					    	weui.alert(data.msg);
					    	break;
					    case 102:
					    	weui.alert(data.msg);
					    	break;
					}
				}
			});
		})
	</script>
